async function addTabs() {
    const items = await chrome.readingList.query({});
    const readingurls = items.map(u => u.url);

    const tabs = await chrome.tabs.query({});
    for (const t of tabs) {
        if (readingurls.indexOf(t.url) > -1 || t.url.startsWith("chrome")) {
            continue;
        }
        await chrome.readingList.addEntry({ title: t.title, url: t.url, hasBeenRead: false });
    }
}

chrome.action.onClicked.addListener(addTabs);